home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / etc / acpi / ibm-wireless.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  2009-10-13  |  608b  |  24 lines

  1. #!/bin/sh
  2.  
  3. test -f /usr/share/acpi-support/state-funcs || exit 0
  4.  
  5. # Find and toggle wireless of bluetooth devices on ThinkPads
  6.  
  7. . /usr/share/acpi-support/state-funcs
  8.  
  9. rfkill list | sed -n -e'/tpacpi_bluetooth_sw/,/^[0-9]/p' | grep -q 'Soft blocked: yes'
  10. bluetooth_state=$?
  11.  
  12. # Note that this always alters the state of the wireless!
  13. toggleAllWirelessStates;
  14.  
  15. # Sequence is Both on, Both off, Wireless only, Bluetooth only
  16. if ! isAnyWirelessPoweredOn; then
  17.     # Wireless was turned off
  18.     if [ "$bluetooth_state" = 0 ]; then
  19.         rfkill unblock bluetooth
  20.     else
  21.         rfkill block bluetooth
  22.     fi
  23. fi
  24.